# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>

pkgname=python-pylsqpack
_name=pylsqpack
pkgver=0.3.17
pkgrel=1
pkgdesc='Python bindings for ls-qpack'
url='https://github.com/aiortc/pylsqpack'
arch=('loong64' 'x86_64')
license=('BSD-3-Clause')
depends=('python')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
b2sums=('209cceb4f136af54dbecbcd4769852760f541d6dec2162f3e7f8adec3150d441174ae2a80108cc3099043ae050f58abd36c7e43c8551fb32dc4878c1e9e5a1d3')

build() {
  cd "${_name}-${pkgver}"
  python -m build --wheel --no-isolation
}

check() {
  local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd ${_name}-${pkgver}
  python -m installer --destdir=test_dir dist/*.whl

  PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH" python -c 'import pylsqpack'
}

package() {
  cd "${_name}-${pkgver}"
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -D LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim:set ts=2 sw=2 et:
